/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package j_table;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JRadioButton;

/**
 *
 * @author Lenovo
 */
public class JFrame1 extends JFrame{
    //JButton p=new JButton("保存设置");
     public ButtonGroup b1=new ButtonGroup();
     public JRadioButton []a1={new JRadioButton("整数"),new JRadioButton("一位小数"),new JRadioButton("两位小数")};
     public JRadioButton []a2={new JRadioButton("仅加减法"),new JRadioButton("加减乘除法")};
     public JRadioButton []a3={new JRadioButton("无括号"),new JRadioButton("有括号")};
     public JRadioButton []a4={new JRadioButton("练习模式（30题）"),new JRadioButton("测试模式（50题）"),new JRadioButton("考试模式（50题，计时25分钟）")};
     public JRadioButton []a5={new JRadioButton("0-10"),new JRadioButton("0-100"),new JRadioButton("0-1000")};
      public JFrame1()
    {
        super("设置");
        Container c=getContentPane();
        c.setLayout(new J_DiagonalLayout1());
        //a1={new JRadioButton("整数"),new JRadioButton("一位小数"),new JRadioButton("两位小数")};
        a1[0].setSelected(true);
        
        for(int i=0;i<3;i++)
        {
            b1.add(a1[i]);
        }
       
        a2[0].setSelected(true);
         ButtonGroup b2=new ButtonGroup();
        for(int i=0;i<2;i++)
        {
            b2.add(a2[i]);
        }
       
        a3[0].setSelected(true);
         ButtonGroup b3=new ButtonGroup();
         JLabel []lab={new JLabel("数字难度："),new JLabel("算法难度："),new JLabel("模式："),new JLabel("数字范围：")};
        for(int i=0;i<2;i++)
        {
            b3.add(a3[i]);
        }
         
         a4[0].setSelected(true);
         ButtonGroup b4=new ButtonGroup();
        for(int i=0;i<3;i++)
        {
            b4.add(a4[i]);
        }
        
         a5[0].setSelected(true);
         ButtonGroup b5=new ButtonGroup();
        for(int i=0;i<3;i++)
        {
            b5.add(a5[i]);
        }
         c.add(lab[0]);
        for(int i=0;i<3;i++)
        {
            c.add(a1[i]);
        }
         c.add(lab[1]);
        for(int i=0;i<2;i++)
        {
            c.add(a2[i]);
        }
        for(int i=0;i<2;i++)
        {
            c.add(a3[i]);
        }
          c.add(lab[2]);
        for(int i=0;i<3;i++)
        {
            c.add(a4[i]);
        }
            c.add(lab[3]);
        for(int i=0;i<3;i++)
        {
            c.add(a5[i]);
        }      
    }
      public int result1(JRadioButton []t)
      {
          int s=0;
          //a1[0].getSelectedIcon();
          int n=t.length;
          for(int i=0;i<n;i++)
          {
              if(t[i].isSelected())
              {
                    //System.out.println(i);
                    s=i;
              }
          }
          return s;
      }
      public int result2(JRadioButton []t)
      {
          int s=1;
          //a1[0].getSelectedIcon();
          int n=t.length;
          for(int i=0;i<n;i++)
          {
              if(t[i].isSelected())
              {
                    //System.out.println(i);
                  for(int j=0;j<i+1;j++)
                       s=10*s;
              }
          }
          return s;
      }

}
